/*
   Copyright 2009 Bégaudeau Stéphane

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

package faneclipse.preferences;

import faneclipse.Activator;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.RGB;

/**
 * @author BEGAUDEAU stephane
 */
public class FanColorPreferenceInitializer extends AbstractPreferenceInitializer {
	/**
	 * The default color.
	 */
	public static final RGB DEFAULT_COLOR = new RGB(0, 0, 0);
	
	/**
	 * The color of the comments by default.
	 */
	public static final RGB COMMENTS_COLOR = new RGB(63, 127, 95);
	
	/**
	 * The color of the keywords by default.
	 */
	public static final RGB KEYWORDS_COLOR = new RGB(129, 6, 88);
	
	/**
	 * The color of the strings by default.
	 */
	public static final RGB STRINGS_COLOR = new RGB(42, 0, 255);
	
	/**
	 * the constructor.
	 */
	public FanColorPreferenceInitializer() {
		super();
	}
	
	/**
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
	public final void initializeDefaultPreferences() {
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		PreferenceConverter.setDefault(store, FanPreferenceConstants.DEFAULT_PREFERENCE, DEFAULT_COLOR);
		PreferenceConverter.setDefault(store, FanPreferenceConstants.KEYWORDS_PREFERENCE, KEYWORDS_COLOR);
		PreferenceConverter.setDefault(store, FanPreferenceConstants.STRINGS_PREFERENCE, STRINGS_COLOR);
		PreferenceConverter.setDefault(store, FanPreferenceConstants.COMMENTS_PREFERENCE, COMMENTS_COLOR);
		
		store.addPropertyChangeListener(new FanColorPropertyChangeListener());
	}
}
